package com.beidouin.GnssMain.models;

import java.util.Random;

/**
 * Created by yuyang on 16/6/23.
 */
public class BeidouSatellite {
    public int msvId;//随机标号
    public int mSnr;//信噪比
    public int mElevation; //仰角
    public int mAzimuth; //方位角
    boolean isUsed;  //参与定位
    boolean[] isReceived = {false, false};  //是否接收该卫星, 0表示上一秒,1表示当前秒
    boolean mUsedInFix;

    public int mSateType;
    public static final int SATE_GPS = 0;
    public static final int SATE_GLONASS = 1;
    public static final int SATE_GALILEO = 2;
    public static final int SATE_BEIDOU = 3;
    public static final int SATE_QZSS = 4;

    public BeidouSatellite(Integer svId, int snr, int elevation, int azimuth) {
        msvId = svId;
        mSnr = snr;
        mElevation = elevation;
        mAzimuth = azimuth;
        isUsed = false;
        isReceived = new boolean[2];
        isReceived[0] = true;
        isReceived[1] = true;
    }

    public void setSateType(int sateType) {
        this.mSateType = sateType;
    }

    public int getSateType() {
        return mSateType;
    }
    public BeidouSatellite(int prn, int snr, int elevation, int azimuth,int sateType) {
        Random random = new Random();
        msvId = prn;
        mSnr = snr;
        mElevation = elevation;
        mAzimuth = azimuth;
        mSateType = sateType;
        isUsed = false;
        isReceived = new boolean[2];
        isReceived[0] = true;
        isReceived[1] = true;
    }

    void setStatus(BeidouSatellite satellite) {
        msvId = satellite.msvId;
        mSnr = satellite.mSnr;
        mElevation = satellite.mElevation;
        mAzimuth = satellite.mAzimuth;
        mSateType = satellite.mSateType;
        isUsed = satellite.isUsed;
        isReceived = satellite.isReceived.clone();
    }

    //get variables
    public int getMsvId() {
        return msvId;
    }

    public int getmSnr() { return mSnr; }

    public int getmElevation() {
        return mElevation;
    }

    public int getmAzimuth() {
        return mAzimuth;
    }

    public boolean getIsReceived() { return isReceived[0]; }

    public boolean getIsUsed() { return isUsed; }

    //set variables
    public void setMsvId(int msvId) {
        this.msvId = msvId;
    }

    public void setmSnr(int mSnr) {
        this.mSnr = mSnr;
    }

    public void setmElevation(int mElevation) {
        this.mElevation = mElevation;
    }

    public void setmAzimuth(int mAzimuth) { this.mAzimuth = mAzimuth; }

    public void setIsReceived(boolean bReceived) {
        isReceived[1] = bReceived;
    }

    public void shiftSecond() {
        isReceived[0] = isReceived[1];
        isReceived[1] = false;
    }

}
